<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': false} }"
    @cancel="handleCancel">
    <GoodsShelfFormEdid ref="realForm" @ok="submitCallback" :disabled="disableSubmit" />
  </j-modal>
</template>

<script>

  import GoodsShelfFormEdid from './GoodsShelfFormEdit'

  export default {
    name: 'GoodsShelfModalEdit',
    components: {
      GoodsShelfFormEdid
    },
    data() {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false,
        // disableFixNum:false
      }
    },
    methods:{
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.addMaxSort = true;
          this.$refs.realForm.add();

        })
      },
      edit (record) {
        this.visible=true
        //编辑
        this.$nextTick(()=>{
          this.$refs.realForm.selectMenuCreat(record.goodsId)

          this.$refs.realForm.visible = false;
          this.$refs.realForm.isMiaosha = record.saleType
          this.$refs.realForm.isFixNum = true
          this.$refs.realForm.edit(record);
          console.log('isFixNum',this.$refs.realForm.isFixNum)
        })




      },
      close () {
        this.$emit('close');
        this.visible = false;
        this.$refs.realForm.visible1 = false
        this.$refs.realForm.confirmLoading=false
        this.$refs.realForm.goodsIds=[]
        this.$refs.realForm.optionsArray=[]
        this.$refs.realForm.detailsDisabled = false
        this.$refs.realForm.isMiaosha = false
        this.$refs.realForm.addMaxSort = false;
      },
      handleOk () {
        this.$refs.realForm.handleOk();
        this.$refs.realForm.addMaxSort = false;
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {

        this.$refs.realForm.visible1 = false
        this.$refs.realForm.confirmLoading=false
        this.$refs.realForm.goodsIds=[]
        this.$refs.realForm.optionsArray=[]
        this.$refs.realForm.detailsDisabled = false
        this.$refs.realForm.isMiaosha = false
        this.$refs.realForm.addMaxSort = false;
        this.close()
        // this.$refs.realForm.isFixNum = false
      }
    }
  }
</script>

<style scoped>
</style>